package com.example.studentstatusmanagement.service;

import com.example.studentstatusmanagement.mapper.SysUserMapper;
import com.example.studentstatusmanagement.pojo.SysUser;
import com.example.studentstatusmanagement.pojo.SysUserExample;
import com.example.studentstatusmanagement.pojo.doo.ReqStudent;
import com.example.studentstatusmanagement.pojo.dto.Student;
import com.example.studentstatusmanagement.pojo.dto.StudentInfo;
import com.example.studentstatusmanagement.pojo.dto.StudentInfoUpdate;
import com.example.studentstatusmanagement.pojo.dto.WelcomeNum;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Guanzhong Hu
 * Date :2020/5/30
 * Description :
 * Version :1.0
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private SysUserMapper sysUserMapper;
    @Override
    public SysUser selectUserPasswordByName(String loginNumber) {
        return sysUserMapper.selectUserPasswordByName(loginNumber);
    }

    @Override
    public Integer updateUserPassword(SysUser sysUser) {
        return sysUserMapper.updateByPrimaryKeySelective(sysUser);
    }

    @Override
    public List<Student> selectStudentInfo(ReqStudent reqStudent) {
        return sysUserMapper.selectStudentInfo(reqStudent);
    }


    // 软删除用户
    @Override
    public int updateByPrimaryKeyUserSelective(SysUser record) {
        return sysUserMapper.updateByPrimaryKeySelective(record);
    }

    // 展示学生信息
    @Override
    public StudentInfo selectStudentInfoById(Integer id) {
        return sysUserMapper.selectStudentInfoById(id);
    }

    // 返回待修改学生信息
    @Override
    public StudentInfoUpdate selectStudentInfoUpdateById(Integer id) {
        return sysUserMapper.selectStudentInfoUpdateById(id);
    }

    @Override
    public List<SysUser> selectByExample(SysUserExample example) {
        return sysUserMapper.selectByExample(example);
    }

    @Override
    public WelcomeNum selectWelcomeNum() {
        return sysUserMapper.selectWelcomeNum();
    }

    @Override
    public int insertSelective(SysUser record) {
        return sysUserMapper.insertSelective(record);
    }
}
